package cn.appsys.service.impl;

import cn.appsys.dao.dataDictionaryDao.DataDictionaryMapper;
import cn.appsys.pojo.DataDictionary;
import cn.appsys.service.DataDictionaryService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service("DataDictionaryService")
public class DataDictionaryServiceImpl implements DataDictionaryService {

    private static final Logger LOGGER = Logger.getLogger(DataDictionaryServiceImpl.class);

    @Resource
    private DataDictionaryMapper dataDictionaryMapper;

    @Override
    public List<DataDictionary> qryAllByCode(String typeCode) {
        List<DataDictionary> dataDictionaries = new ArrayList<>();
        try {
            dataDictionaries = dataDictionaryMapper.qryAllByCode(typeCode);
            if(null == dataDictionaries){
                LOGGER.debug("DataDictionaryServiceImpl.qryAllByCode 方法查询为空》》》");
            }else{
                LOGGER.debug("DataDictionaryServiceImpl.qryAllByCode 方法查询成功》》》");
            }
        } catch (Exception e) {
//            e.printStackTrace();
            LOGGER.error("DataDictionaryServiceImpl.qryAllByCode 方法查询异常》》》"+e.getMessage());
        }
        return dataDictionaries;
    }

    @Override
    public List<DataDictionary> getDataDictionaryList(String typeCode) throws Exception {
        return dataDictionaryMapper.getDataDictionaryList(typeCode);
    }
}
